package cn.corgy.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyPerson implements InvocationHandler {

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("代理前处理");
        Object invoke = method.invoke(new Wo(), args);
        Wo wo = (Wo) invoke;
        System.out.println(wo.getInstance());
        System.out.println("代理后处理");
        return invoke;
    }
}
